<script language="JavaScript" type="text/javascript" src="{$shouquanurl}"></script>
<input type="hidden" name="reply_id" value="{$reply['id']}" />
<input name="weihezi_ValidCode_server" type="hidden" id="weihezi_ValidCode_server" >
<input name="shouquan" type="hidden" value="{$shouquan}" >
<div class="panel panel-default">
	<div class="panel-heading">
		活动设置
	</div>
	<div class="panel-body">
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动名称</label>
            <div class="col-sm-9 col-xs-12">
               	<input type="text" id="title" class="form-control" name="title" value="{$reply['title']}">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动时间</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_daterange('datelimit', array('start'=>date('Y-m-d H:i',$reply['starttime']),'end'=>date('Y-m-d H:i',$reply['endtime'])), true)}
            </div>
        </div>		
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">数字开始值</label>
			<div class="col-sm-9">
				<input type="text" placeholder="数字开始值" value="{$reply['luckynumstart']}" class="form-control" name="luckynumstart">
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">数字过滤数</label>
			<div class="col-sm-9">
				<input type="text" placeholder="数字过滤数" value="{$reply['luckynumfilter']}" class="form-control" name="luckynumfilter">
				<span class="help-block">过滤哪些不吉利的数，多个请用英文逗号分隔，例如：4,7  比如你不想出现带4，就输入4即可，这样4,14,24,N4就会跳过</span>
			</div>			
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">活动规则以及奖品领取说明</label>
			<div class="col-sm-9">
				<textarea style="height:60px;" id="ruletext" name="ruletext" class="form-control richtext" cols="60">{$reply['ruletext']}</textarea>
			</div>			
		</div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享朋友或朋友圈图</label>
            <div class="col-sm-9 col-xs-12">
               	{php echo tpl_form_field_image('shareimg',$reply['shareimg']);}
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题</label>
            <div class="col-sm-9 col-xs-12">
               	<input type="text" id="sharetitle" class="form-control" name="sharetitle" value="{$reply['sharetitle']}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享描述</label>
            <div class="col-sm-9 col-xs-12">
     	        <textarea style="height:60px;" id="sharedesc" name="sharedesc" class="form-control" cols="60">{$reply['sharedesc']}</textarea>				    
            </div>
        </div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		兑奖参数
	</div>
	<div class="panel-body">
		<div class="form-group">
 			<label class="col-xs-12 col-sm-3 col-md-2 control-label">参与限制</label>
            <div class="col-sm-9 col-xs-6">
               	<div class="input-group">
					<label for="limittype0" class="radio-inline">
					    <input type="radio" name="limittype" value="0" id="limittype0" {if empty($reply) || $reply['limittype'] == 0}checked="true"{/if} onclick="$('#awardnum').show();"/> 无限制
					</label>
					<label for="limittype1" class="radio-inline">
					    <input type="radio" name="limittype" value="1" id="limittype1" {if empty($reply) || $reply['limittype'] == 1}checked="true"{/if} onclick="$('#awardnum').hide();"/> 只能一次
					</label>
				</div>				
            </div>
        </div>
		<div class="form-group" id="awardnum"{if empty($reply) || $reply['limittype'] == 1} style="display: none;"{/if}>
 			<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖限制</label>
            <div class="col-sm-9 col-xs-6">
				<div class="input-group">
                    <span class="input-group-addon">最多中奖</span>
					<input class="form-control" type="text" value="{$reply['awardnum']}" name="awardnum">
                    <span class="input-group-addon">份</span>
                </div>
            </div>
        </div>
		<div class="form-group">
 			<label class="col-xs-12 col-sm-3 col-md-2 control-label">兑奖输入项提示词</label>
            <div class="col-sm-9 col-xs-6">
				<input type="text" class="form-control" name="ticketinfo" value="{$reply['ticketinfo']}" />
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 兑奖输入参数项</label>
            <div class="col-sm-9 col-xs-12">
				<div style="border:1px #eee dashed; padding:10px;background:#F5F5F5;">					
               	    <label for="isrealname" class="checkbox-inline"><input id="isrealname" type="checkbox" name="isrealname" value="1" {if $reply['isrealname'] == 1}checked="checked"{/if}> 姓名</label>
				    <label for="ismobile" class="checkbox-inline"><input id="ismobile" type="checkbox" name="ismobile" value="1" {if $reply['ismobile'] == 1}checked="checked"{/if}> 手机</label>
				    <label for="isqq" class="checkbox-inline"><input id="isqq" type="checkbox" name="isqq" value="1" {if $reply['isqq'] == 1}checked="checked"{/if}> QQ号</label>
				    <label for="isemail" class="checkbox-inline"><input id="isemail" type="checkbox" name="isemail" value="1" {if $reply['isemail'] == 1}checked="checked"{/if}> 邮箱</label>
				    <label for="isaddress" class="checkbox-inline"><input id="isaddress" type="checkbox" name="isaddress" value="1" {if $reply['isaddress'] == 1}checked="checked"{/if}> 地址</label>
					<label for="isgender" class="checkbox-inline"><input id="isgender" type="checkbox" name="isgender" value="1" {if $reply['isgender'] == 1}checked="checked"{/if}> 性别</label>
					<label for="istelephone" class="checkbox-inline"><input id="istelephone" type="checkbox" name="istelephone" value="1" {if $reply['istelephone'] == 1}checked="checked"{/if}> 固话</label>
					<label for="isidcard" class="checkbox-inline"><input id="isidcard" type="checkbox" name="isidcard" value="1" {if $reply['isidcard'] == 1}checked="checked"{/if}> 证件</label>
					<label for="iscompany" class="checkbox-inline"><input id="iscompany" type="checkbox" name="iscompany" value="1" {if $reply['iscompany'] == 1}checked="checked"{/if}> 公司</label>
					<label for="isoccupation" class="checkbox-inline"><input id="isoccupation" type="checkbox" name="isoccupation" value="1" {if $reply['isoccupation'] == 1}checked="checked"{/if}> 职业</label>
					<label for="isposition" class="checkbox-inline"><input id="isposition" type="checkbox" name="isposition" value="1" {if $reply['isposition'] == 1}checked="checked"{/if}> 职位</label>
					</div>
					<div class="help-block">必需选择一个参数兑奖 活动开启后最好不要修改 请谨慎选择 重命显示请修改下面的参数</div>
            </div>
        </div>
		<div class="form-group">
 			<label class="col-xs-12 col-sm-3 col-md-2 control-label">兑奖输入参数重命名</label>
            <div class="col-sm-9 col-xs-6">
				<input type="text" class="form-control" name="isfansname" value="{$reply['isfansname']}" />
				<div class="help-block">与上面的参数一一对应，请直接修改不要改变','这个字符</div>
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label"> 兑奖输入参数同步</label>
            <div class="col-sm-9 col-xs-12">
				<label for="isfans_0" class="radio-inline"><input id="isfans_0" type="radio" name="isfans" value="0" {if $reply['isfans'] == 0}checked="checked"{/if}> 参数项只保留本模块下</label>
				<label for="isfans_1" class="radio-inline"><input id="isfans_1" type="radio" name="isfans" value="1"  {if $reply['isfans'] == 1}checked="checked"{/if}> 参数项同步更新至官方会员信息表中</label>
            </div>
        </div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		活动提示信息设置
	</div>
	<div class="panel-body">
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动结束提示语</label>
            <div class="col-sm-9 col-xs-12">
				<input type="text" placeholder="活动结束提示语" value="{$reply['end_instruction']}" class="form-control" name="end_instruction">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动暂停提示语</label>
            <div class="col-sm-9 col-xs-12">
				<input type="text" placeholder="活动暂停提示语" value="{$reply['show_instruction']}" class="form-control" name="show_instruction">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动未开始提示语</label>
            <div class="col-sm-9 col-xs-12">
				<input type="text" placeholder="活动未开始提示语" value="{$reply['time_instruction']}" class="form-control" name="time_instruction">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖未提交兑奖信息提示语</label>
            <div class="col-sm-9 col-xs-12">
				<input type="text" placeholder="中奖未提交兑奖信息提示语" value="{$reply['award_instruction']}" class="form-control" name="award_instruction">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">超出参与活动限制提示语</label>
            <div class="col-sm-9 col-xs-12">
				<input type="text" placeholder="超出参与活动限制提示语" value="{$reply['limit_instruction']}" class="form-control" name="limit_instruction">
            </div>
        </div>
		<div class="form-group">
            <label class="col-xs-12 col-sm-3 col-md-2 control-label">超出中奖次数限制提示语</label>
            <div class="col-sm-9 col-xs-12">
               	<input type="text" placeholder="超出中奖次数限制提示语" value="{$reply['awardnum_instruction']}" class="form-control" name="awardnum_instruction">
            </div>
        </div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">数字提示语</label>
			<div class="col-sm-9">
				<input type="text" placeholder="当前数字是 {##LUCKYNUM##} ！" value="{$reply['currentprompt']}" class="form-control" name="currentprompt">
				<span class="help-block">
					{##LUCKYNUM##} 表示当前数字 请根据您的需要填写，如：{##LUCKYNUM##} 数字<br/>
					<strong class="text-danger">如果不填，则为默认为：当前数字是{##LUCKYNUM##} ！</strong>
				</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖提示语</label>
			<div class="col-sm-9">
				<input type="text" placeholder="恭喜您，当前数字是 {##LUCKYNUM##}，获得 {##AWARD##} 奖品！" value="{$reply['awardprompt']}" class="form-control" name="awardprompt">
				<span class="help-block">
					{##LUCKYNUM##} 表示当前数字 {##AWARD##} 表示奖品名称 {##DESCRIPTION##} 表示奖品描述<br/>
					请根据您的需要填写，如：数字{##LUCKYNUM##}，中奖啦，奖品是{##AWARD##}{##DESCRIPTION##}<br/>
					<strong class="text-danger">如果不填，则为默认为：恭喜您，当前数字是 {##LUCKYNUM##}，获得 {##AWARD##} 奖品！</strong>
				</span>
			</div>
		</div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		奖品信息
	</div>
	<div class="panel-body">
		{if $awards}
			{loop $awards $item}
			<div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖数字</label>
					<div class="col-sm-9">
						<textarea style="height:60px;" id='award_number[{$item[id]}]' name="award_number[{$item[id]}]" placeholder="请输入中奖数字，可输入多个数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" cols="60">{$item[numbers]}</textarea>
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品名称</label>
					<div class="col-sm-9">
						<input type="text" placeholder="请输入奖品名称" class="form-control" name="award_title[{$item[id]}]" value="{$item[title]}">
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品描述</label>
					<div class="col-sm-9">
						<input type="text" placeholder="请输入奖品描述" class="form-control" name="award_desc[{$item[id]}]" value="{$item[description]}">
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
					<div class="col-sm-9">
						{if $isaward}
						<a class="btn btn-danger" href="">已有用户中此奖品，不能删除</a>
						{else}
						<a class="btn btn-danger" href="{$item[delete_url]}">删除此奖品</a>
						{/if}
					</div>
				</div>
				<hr/>
			</div>
			{/loop}
		{else}
		<div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖数字</label>
				<div class="col-sm-9">
					<textarea style="height:60px;" id='newaward_number[]' name="newaward_number[]" placeholder="请输入中奖数字，可输入多个数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" cols="60"></textarea>
					<span class="help-block"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品名称</label>
				<div class="col-sm-9">
					<input type="text" placeholder="请输入奖品名称" class="form-control" name="newaward_title[]">
					<span class="help-block"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品描述</label>
				<div class="col-sm-9">
					<input type="text" placeholder="请输入奖品描述" class="form-control" name="newaward_desc[]">
					<span class="help-block"></span>
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
				<div class="col-sm-9">
					<button type="button" class="btn btn-danger btn_del_award">
						删除
					</button>
				</div>
			</div>-->
			<hr/>
		</div>
		{/if}
		<span id="award_insert_flag" style="display: none"></span>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">
			</label>
			<div class="col-sm-9">
				<button id="btn_add_award" type="button" class="btn btn-warning">
					<span class="glyphicon glyphicon-plus"></span> 添加奖品
				</button>
			</div>
		</div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		赞助商广告设置
	</div>
	<div class="panel-body">
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">赞助商广告之一</label>
			<div class="col-sm-9 col-xs-12">
				<div class="input-group">
					<span class="input-group-addon">文字</span>
					<input type="text" class="form-control" name="sponsors1" id="sponsors1" value="{$reply['sponsors1']}" />
					<span class="input-group-addon" style="border-left:0px;border-right:0px;">链接</span>
					<input type="text" class="form-control" name="sponsors1link" id="sponsors1link" value="{$reply['sponsors1link']}" />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">赞助商广告之二</label>
			<div class="col-sm-9 col-xs-12">
				<div class="input-group">
					<span class="input-group-addon">文字</span>
					<input type="text" class="form-control" name="sponsors2" id="sponsors2" value="{$reply['sponsors2']}" />
					<span class="input-group-addon" style="border-left:0px;border-right:0px;">链接</span>
					<input type="text" class="form-control" name="sponsors2link" id="sponsors2link" value="{$reply['sponsors2link']}" />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">赞助商广告之三</label>
			<div class="col-sm-9 col-xs-12">
				<div class="input-group">
					<span class="input-group-addon">文字</span>
					<input type="text" class="form-control" name="sponsors3" id="sponsors1" value="{$reply['sponsors3']}" />
					<span class="input-group-addon" style="border-left:0px;border-right:0px;">链接</span>
					<input type="text" class="form-control" name="sponsors3link" id="sponsors3link" value="{$reply['sponsors3link']}" />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">赞助商广告之四</label>
			<div class="col-sm-9 col-xs-12">
				<div class="input-group">
					<span class="input-group-addon">文字</span>
					<input type="text" class="form-control" name="sponsors4" id="sponsors4" value="{$reply['sponsors4']}" />
					<span class="input-group-addon" style="border-left:0px;border-right:0px;">链接</span>
					<input type="text" class="form-control" name="sponsors4link" id="sponsors4link" value="{$reply['sponsors4link']}" />
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">赞助商广告之五</label>
			<div class="col-sm-9 col-xs-12">
				<div class="input-group">
					<span class="input-group-addon">文字</span>
					<input type="text" class="form-control" name="sponsors5" id="sponsors5" value="{$reply['sponsors5']}" />
					<span class="input-group-addon" style="border-left:0px;border-right:0px;">链接</span>
					<input type="text" class="form-control" name="sponsors5link" id="sponsors5link" value="{$reply['sponsors5link']}" />
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	function validateReplyForm(formobj, $, _, util, $scope, $http) {
		/*if (formobj['newaward_number[]'].value == '') {
			util.message('请填写中奖数字', '', 'error');
			return false;
		}
		if (formobj['newaward_title[]'].value == '') {
			util.message('请填写奖品名称', '', 'error');
			return false;
		}
		if (formobj['newaward_desc[]'].value == '') {
			util.message('请填写奖品描述', '', 'error');
			return false;
		}*/
	}
	var award_row_data = [
		['中奖数字', '<textarea style="height:60px;" id="newaward_number[]" name="newaward_number[]" placeholder="请输入中奖数字，可输入多个数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" cols="60"></textarea>', ''],
		['奖品名称', '<input type="text" placeholder="请输入奖品名称" class="form-control" name="newaward_title[]">', ''],
		['奖品描述', '<input type="text" placeholder="请输入奖品描述" class="form-control" name="newaward_desc[]">', ''],
	];
	$('#btn_add_award').bind('click', function(){
		var content = '', v = '';
		content += '<div>';
		for (var i=0; i<award_row_data.length; i++) {
			v = award_row_data[i];
			content += '<div class="form-group">';
			content += '<label class="col-xs-12 col-sm-3 col-md-2 control-label">'+v[0]+'</label>';
			content += '<div class="col-sm-9">';
			content += v[1];
			content += '<span class="help-block">'+v[2]+'</span>';
			content += '</div>';
			content += '</div>';
		}
		content += '<div class="form-group">';
		content += '<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>';
		content += '<div class="col-sm-9">';
		content += '<button type="button" class="btn btn-danger btn_del_award">删除</button>';
		content += '</div>';
		content += '</div>';
		content += '<hr/>';
		content += '</div>';
		$('#award_insert_flag').before(content);
		$('.btn_del_award').bind('click', function(){
			var obj = $(this).parent().parent().parent();
			obj.slideUp(300, function() {
				obj.remove();
			});
		});
	});
	document.getElementById("weihezi_ValidCode_server").value=weihezi_ValidCode_server;
	$(document).ready(function(){
		//$('#btn_add_award').trigger('click');
	});
	require(['jquery', 'util'], function($, u){
		$(function(){
			u.editor($('.richtext')[0]);			
		});
    });
</script>